﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;

namespace WebApplication.Controls
{
    public partial class UCCheDe : System.Web.UI.UserControl
    {
        string ID = "";
        protected void Page_Load(object sender, EventArgs e)
        {
            ID = Request.QueryString["IDChuDe"];
            if (!IsPostBack)
            {
                Display();
            }

        }
        private void Display()
        {
            repChuDe.DataSource = ChuDeBLL.LayTatCa();
            repChuDe.DataBind();

        }
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            repChuDe.ItemDataBound += new RepeaterItemEventHandler(repChuDe_ItemDataBound);
        }
        protected void repChuDe_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
            {
                Entities.ChuDe data = e.Item.DataItem as Entities.ChuDe;
                string Id = data.IDChuDe.ToString();
                HyperLink lnkChuDe = (HyperLink)e.Item.FindControl("lnkChuDe");
                lnkChuDe.Text = data.TenChuDe;
                lnkChuDe.NavigateUrl = LinkBLL.ToChuDe(Id);
                lnkChuDe.ToolTip = data.MoTa;
            }

        }
    }
}